import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StationVO, StationForm, StationQuery } from '@/api/station/types';

/**
 * 查询站房设信息列表
 * @param query
 * @returns {*}
 */

export const listStation = (query?: StationQuery): AxiosPromise<StationVO[]> => {
  return request({
    url: '/biz-station/station/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询站房设信息详细
 * @param id
 */
export const getStation = (id: string | number): AxiosPromise<StationVO> => {
  return request({
    url: '/biz-station/station/' + id,
    method: 'get'
  });
};

/**
 * 新增
 * @param data
 */
export const addStation = (data: StationForm) => {
  return request({
    url: '/biz-station/station',
    method: 'post',
    data: data
  });
};

/**
 * 修改
 * @param data
 */
export const updateStation = (data: StationForm) => {
  return request({
    url: '/biz-station/station',
    method: 'put',
    data: data
  });
};

/**
 * 删除
 * @param id
 */
export const delStation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz-station/station/' + id,
    method: 'delete'
  });
};

/**
 * 切换调试模式
 * @param stationId 站房ID
 * @param operationalMode 
 * @returns 
 */
export const changeOperationalMode = (stationId: string | number, operationalMode: string | number) => {
  return request({
    url: '/biz-station/station/' + stationId + '/' + operationalMode,
    method: 'put'
  });
};

/**
 * 删除站房附件
 * @param id
 */
export const delStationAttachment = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz-station/station/attachment/' + id,
    method: 'delete'
  });
};
